<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Person(name, age) {
            this.name = name;
            this.age = age;

        }

        var obj = {
            nation: 'China',
            speak() {
                console.log('hello');
            },
            play() {
                console.log('王者荣耀');
            }
        }

        // 将Person构造方法prototype属性指向到obj
        Person.prototype = obj;
        Person.prototype.constructor = Person;
        console.log(Person.prototype.constructor);


        function Person(name, age) {
            this.name = name;
            this.age = age;
        }

        Person.prototype.speak = function() {

            console.log('hello');
        }

        Person.prototype.nation = "chian";
        Person.prototype.address = '北京市  ';
        var p1 = new Person('Tom', 12);
        var p2 = new Person('Li', 30);
    </script>
</body>

</html>